{extend name="PublicBase/showBase" /}

{block name="body"}
<div class="main">
    <div class="row">
        <div class="col-md-12">
            <section class="tile color transparent-black">
                <div class="tile-header bg-transparent-black-2">
                    <h1>
                        {if condition="$Info eq ''"}
                            {:lang('XtCkXz')}
                        {else /}
                            {:lang('XtCkGx')}
                        {/if}
                    </h1>
                    <div class="controls">
                        <a href="javascript:void(0);" onclick="window.history.back();"><i class="fa fa-arrow-left"></i></a>
                        {if condition="$Info eq ''"}
                            <a href="{:url('SystemLexicon/showAdd')}"><i class="fa fa-refresh"></i></a>
                        {else /}
                            <a href="{:url('SystemLexicon/showEdit', array('id'=>$Info['lexicon_id']))}"><i class="fa fa-refresh"></i></a>
                        {/if}
                    </div>
                </div>
                <div class="tile-body nopadding">
                    <form class="FormTable" action="" method="post">
                        <div class="tile-body">
                            <div class="row">
                                <div class="form-group col-sm-12">
                                    <label>{:lang('XtCkBs')}</label>
                                    <input type="text" class="form-control" name="lexicon_name" value="{$Info.lexicon_name}" placeholder="{:lang('XtCkBsWk')}{:lang('XtCkBsAl')}" />
                                </div>
                                <div class="form-group col-sm-12">
                                    <label>{:lang('XtCkMc')}</label>
                                    <input type="text" class="form-control" name="lexicon_title" value="{$Info.lexicon_title}" placeholder="{:lang('XtCkMcWk')}" />
                                </div>
                                <div class="form-group col-sm-12">
                                    <label>{:lang('XtCkSm')}</label>
                                    <input type="text" class="form-control" name="lexicon_remark" value="{$Info.lexicon_remark}" placeholder="{:lang('XtCkSmWk')}" />
                                </div>
                                <div class="form-group col-sm-12">
                                    <label>{:lang('XtCkNr')}（<a style="color:#fff" href="javascript:void(0);" onclick="LexiconContentAdd();"><i class="fa fa-plus"></i></a>）</label>
                                </div>
                                <div id="LexiconContent">
                                    {if condition="$Info eq ''"}
                                        <div class="LexiconContent">
                                            <div class="form-group col-sm-4">
                                                <label>{:lang('XtCkNrCz')}（<a style="color:#fff" href="javascript:void(0);" onclick="LexiconContentDel(this);"><i class="fa fa-close"></i></a>）</label>
                                                <input type="text" class="form-control" name="content_value[]" placeholder="{:lang('XtCkNrCzWk')}" />
                                            </div>
                                            <div class="form-group col-sm-4">
                                                <label>{:lang('XtCkNrCx')}</label>
                                                <input type="text" class="form-control" name="content_name[]" placeholder="{:lang('XtCkNrCxWk')}" />
                                            </div>
                                            <div class="form-group col-sm-4">
                                                <label>{:lang('XtCkNrPx')}</label>
                                                <input type="text" class="form-control" name="content_sort[]" placeholder="{:lang('XtCkNrPxWk')}" />
                                            </div>
                                        </div>
                                    {else /}
                                        {volist name="Info['lexicon_content']" id="vo"}
                                            <div class="LexiconContent">
                                                <div class="form-group col-sm-4">
                                                    <label>{:lang('XtCkNrCz')}（<a style="color:#fff" href="javascript:void(0);" onclick="LexiconContentDel(this);"><i class="fa fa-close"></i></a>）</label>
                                                    <input type="text" class="form-control" name="content_value[]" value="{$vo.content_value}" placeholder="{:lang('XtCkNrCzWk')}" />
                                                </div>
                                                <div class="form-group col-sm-4">
                                                    <label>{:lang('XtCkNrCx')}</label>
                                                    <input type="text" class="form-control" name="content_name[]" value="{$vo.content_name}" placeholder="{:lang('XtCkNrCxWk')}" />
                                                </div>
                                                <div class="form-group col-sm-4">
                                                    <label>{:lang('XtCkNrPx')}</label>
                                                    <input type="text" class="form-control" name="content_sort[]" value="{$vo.content_sort}" placeholder="{:lang('XtCkNrPxWk')}" />
                                                </div>
                                            </div>
                                        {/volist}
                                    {/if}
                                </div>
                                <div class="form-group col-sm-12">
                                    <label>{:lang('XtCkPx')}</label>
                                    <input type="text" class="form-control" name="lexicon_sort" value="{$Info.lexicon_sort|default=0}" placeholder="{:lang('XtCkPxWk')}{:lang('XtCkPxAl')}" />
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="tile-footer bg-transparent-black-2 rounded-bottom-corners">
                    <div class="row">
                        <div class="col-sm-12 text-center">
                            <button type="button" class="btn btn-{:config('CNF_BTNCOLOR')} ajax-post">{:lang('XtAnTj')}</button>
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </div>
</div>
{/block}

{block name="script"}
    <script>
        $(function(){

        })

        function LexiconContentAdd(){
            var html = '<div class="LexiconContent">'+
                            '<div class="form-group col-sm-4">'+
                                '<label>{:lang("XtCkNrCz")}（<a style="color:#fff" href="javascript:void(0);" onclick="LexiconContentDel(this);"><i class="fa fa-close"></i></a>）</label>'+
                                '<input type="text" class="form-control" name="content_value[]" placeholder="{:lang("XtCkNrCzWk")}" />'+
                            '</div>'+
                            '<div class="form-group col-sm-4">'+
                                '<label>{:lang("XtCkNrCx")}</label>'+
                                '<input type="text" class="form-control" name="content_name[]" placeholder="{:lang("XtCkNrCxWk")}" />'+
                            '</div>'+
                            '<div class="form-group col-sm-4">'+
                                '<label>{:lang("XtCkNrPx")}</label>'+
                                '<input type="text" class="form-control" name="content_sort[]" placeholder="{:lang("XtCkNrPxWk")}" />'+
                            '</div>'+
                        '</div>';
            $('#LexiconContent').prepend(html);
        }

        function LexiconContentDel(obj){
            $(obj).parents('.LexiconContent').remove();
        }
    </script>
{/block}
      
